{include file="Public:header" /}
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5 style="line-height: 30px;font-weight: bold;">管理员列表</h5>
                <a href="{:url('auth/userAdd')}" class="btn btn-sm btn-info" style="margin-left: 10px;">添加用户</a>
            </div>
            <div class="ibox-content">

                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>用户名</th>
                        <th>用户组</th>
                        <th>状态</th>
                        <th>创建时间</th>
                        <th style="text-align: center;">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="vo"}
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.username}</td>
                        <td>{$vo.title}</td>
                        <td>
                            {if condition="$vo.status eq 1"}
                            正常
                            {else/}
                            禁用
                            {/if}
                        </td>
                        <td>{$vo.create_time}</td>
                        <td style="text-align: center">
                            <a href="{:url('Auth/userEdit',array('uid' => $vo.id))}" class="edit btn btn-sm btn-info">编辑</a>
                            {if condition='$vo.is_super neq 1'}<a href="javascript:;" class="del btn btn-sm btn-info" uid="{$vo.id}">删除</a>{/if}
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                {$list->render()}
            </div>
        </div>
    </div>
</div>
{include file="Public:footer" /}
<script>
    $(function(){
        //删除供应商
        $('.del').click(function(){
            var uid = $(this).attr('uid');
            layer.msg('确定要删除该用户？',{
                time:0,
                btn:['确定','取消'],
                yes:function (index) {
                    layer.close(index);
                    $.get("{:url('/Auth/userDel/uid/"+ uid +"')}",function(data){
                        if(data.code == 0)
                        {
                            layer.msg(data.msg);
                            setTimeout(function(){
                                window.location.href = data.url;
                            },200);
                        }else{
                            layer.msg(data.msg);
                        }
                    },'json');
                }
            });
        });
    });
</script>